package com.tzxscu.hosdrool.drools;
import com.tzxscu.hosdrool.models.BillItems;

import org.kie.api.KieServices;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;

import java.util.ArrayList;
import java.util.List;

public class droolsapi {
    private static List<BillItems> listbill = new ArrayList<>();
    public  static String drools(List<BillItems> billItems){
        KieServices ks = KieServices.Factory.get();
        KieContainer kieContainer = ks.getKieClasspathContainer();
        KieSession kieSession = kieContainer.newKieSession("rulesSession");
        kieSession.insert(billItems);
        kieSession.fireAllRules();
        kieSession.dispose();
        System.out.println(billItems.toString());
        return billItems.toString();
    }
}
